package com.ruoyi.web.controller.wb;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.wb.domain.WbClassifyYearContentThree;
import com.ruoyi.wb.service.IWbClassifyYearContentThreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 维保年度类目三级表Controller
 * 
 * @author ruoyi
 * @date 2024-11-18
 */
@RestController
@RequestMapping("/system/WbClassifyYearContentThree")
public class WbClassifyYearContentThreeController extends BaseController
{
    @Autowired
    private IWbClassifyYearContentThreeService wbClassifyYearContentThreeService;

    /**
     * 查询维保年度类目三级表列表
     */
    @GetMapping("/list")
    public TableDataInfo list(WbClassifyYearContentThree wbClassifyYearContentThree)
    {
        startPage();
        List<WbClassifyYearContentThree> list = wbClassifyYearContentThreeService.selectWbClassifyYearContentThreeList(wbClassifyYearContentThree);
        return getDataTable(list);
    }

    /**
     * 导出维保年度类目三级表列表
     */
    @Log(title = "维保年度类目三级表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WbClassifyYearContentThree wbClassifyYearContentThree)
    {
        List<WbClassifyYearContentThree> list = wbClassifyYearContentThreeService.selectWbClassifyYearContentThreeList(wbClassifyYearContentThree);
        ExcelUtil<WbClassifyYearContentThree> util = new ExcelUtil<WbClassifyYearContentThree>(WbClassifyYearContentThree.class);
        util.exportExcel(response, list, "维保年度类目三级表数据");
    }

    /**
     * 获取维保年度类目三级表详细信息
     */
    @GetMapping(value = "/{classifyContentId}")
    public AjaxResult getInfo(@PathVariable("classifyContentId") Long classifyContentId)
    {
        return success(wbClassifyYearContentThreeService.selectWbClassifyYearContentThreeByClassifyContentId(classifyContentId));
    }

    /**
     * 新增维保年度类目三级表
     */
    @Log(title = "维保年度类目三级表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WbClassifyYearContentThree wbClassifyYearContentThree)
    {
        return toAjax(wbClassifyYearContentThreeService.insertWbClassifyYearContentThree(wbClassifyYearContentThree));
    }

    /**
     * 修改维保年度类目三级表
     */
    @Log(title = "维保年度类目三级表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WbClassifyYearContentThree wbClassifyYearContentThree)
    {
        return toAjax(wbClassifyYearContentThreeService.updateWbClassifyYearContentThree(wbClassifyYearContentThree));
    }

    /**
     * 删除维保年度类目三级表
     */
    @Log(title = "维保年度类目三级表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{classifyContentIds}")
    public AjaxResult remove(@PathVariable Long[] classifyContentIds)
    {
        return toAjax(wbClassifyYearContentThreeService.deleteWbClassifyYearContentThreeByClassifyContentIds(classifyContentIds));
    }
}
